﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using MetroDropBox.Shared;

namespace MetroGoogle.External.Google
{
    public class GoogleClient : oAuthClientBase
    {
        string _scope = "";
        public GoogleClient(string key, string secret, string scope)
            : base(key, secret)
        {
            _scope = scope;
        }

        protected override void init()
        {

            usesAuthHeader = true;
            upperCaseUrlEncoding = true;
            useSha1Signing = true;
            authHeaderRealm = "";
            getRequestTokenURL = "https://www.google.com/accounts/OAuthGetRequestToken";
            getRequestTokenMethod = "GET";
            getUserLoginURL = "https://www.google.com/accounts/OAuthAuthorizeToken";
            getAuthTokenURL = "https://www.google.com/accounts/OAuthGetAccessToken";

        }
        protected override void injectAdditionalParams(string url, System.Collections.Generic.Dictionary<string, string> parms)
        {
            if (url.EndsWith("OAuthGetRequestToken", StringComparison.InvariantCultureIgnoreCase) && !parms.ContainsKey("scope"))
            {
                parms["scope"] = _scope;
            }
        }
    }
}
